package com.ruoyi.system.api.factory;

import com.ruoyi.system.api.RemoteThirdService;
import com.ruoyi.system.api.domain.FoodBean;
import com.ruoyi.system.api.domain.ShopBean;
import com.ruoyi.system.api.domain.ShopBillDetailBean;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 用户服务降级处理
 * 
 * @author ruoyi
 */
@Component
public class ThirdServiceFallbackFactory implements FallbackFactory<RemoteThirdService>
{
    private static final Logger log = LoggerFactory.getLogger(ThirdServiceFallbackFactory.class);

    @Override
    public RemoteThirdService create(Throwable throwable) {
        log.error("集团服务调用失败:{}", throwable.getMessage());
        return new RemoteThirdService() {
            @Override
            public List<ShopBean> getDocAllShops(Long groupID) {
                System.out.println("获取集团下所有的店");
                return null;
            }

            @Override
            public List<FoodBean> getMenu(Long groupID, Long shopID) {
                System.out.println("获取集团下某个店的所有菜品");
                return null;
            }

            @Override
            public List<ShopBillDetailBean> getShopBillDetail(Long groupID, Long shopID, Long reportDate) {
                System.out.println("获取集团下某个店每天的账单");
                return null;
            }


        };
    }
}
